<!-- 企业信息管理 -->
<template>
  <div class="app-wrapper">
    <headerTitle :titleList="titleList" :hideButton="true" />
    <div class="app-container">
      <div class="containerMain">
        <div class="detail-container">
          <div class="detail-tab">
            <div class="tab-container">
              <el-form
                ref="formName"
                :rules="rules"
                style="width:78%;color: #333;font-size: 14px;"
                :model="infoForm"
                label-width="160px"
              >
                <el-form-item label="企业编号" prop="entNum">
                  <div class="infoFormSty">
                    <span>{{ infoForm.entNum }}</span>
                  </div>
                </el-form-item>
                <el-form-item label="企业名称" prop="entName">
                  <div class="infoFormSty">
                    <span>{{ infoForm.entName }}</span>
                  </div> </el-form-item
                >
                <el-form-item label="entSecret" prop="entName">
                  <div class="infoFormSty">
                    <span>{{ infoForm.entSecret }}</span>
                  </div> </el-form-item
                >


                <el-form-item label="默认分辨率" prop="resolution">
                  <el-select v-model="infoForm.resolution" placeholder="请选择" disabled>
                    <el-option
                      v-for="item in resolutionList"
                      :key="item.type"
                      :label="item.resolutionRatio"
                      :value="item.type">
                    </el-option>
                  </el-select>
                </el-form-item>

              </el-form>
              <div style="width:78%; margin-left:160px;">
                <el-button size="mini" type="default" @click="goBack"
                  >返回</el-button
                >
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import HeaderTitle from "@/components/Headertitle/index";
import {
  getEntInfo, getVideoRatioList,
  saveEnt
} from "@/api/enterpriseinfo";
import { log } from 'util';
export default {
  data() {
    return {
      id: "",
      titleList: [{ title: "企业信息" }],
      listLoading: true, // loading加载
      resolutionList:[],
      entName: "",
      entNum: "",
      infoForm: {
        entNum: "",
        entName: "",
        entSecret:"",
        resolution:null,
        industryName: "",
        userName: "", // 客户姓名
        userPhone: "", // 手机号码
        userEmail: "", //邮箱
        address: ""
      },
      rules: {
        entNum: [{ required: true }],
        entName: [{ required: true }],
        industryId: [{ required: true }],
        resolution:[
          { required: true},
        ],
      }
    };
  },
  mounted() {
    const { id } = this.$route.params;
    this.id = id;
    this.update(id);
    this.getVideoRatioList();
  },
  components: {
    HeaderTitle
  },
  methods: {
    getVideoRatioList(){
      getVideoRatioList().then(res => {
        this.resolutionList = res.data
      })
    },
    //返回列表页
    goBack() {
      this.$router.push({
        name: "enterpriseinfo"
      });
    },
    //表头背景颜色修改
    headerStyle({ row, column, rowIndex, columnIndex }) {
      if (rowIndex == 0) {
        return "background:#F5F6FB;color:#666";
      }
    },

    update(id) {
      this.titleList.push({ title: "查看" });
      console.log(id);
      getEntInfo(id).then(response => {
        this.infoForm = response.data;
        console.log(this.infoForm)
      });
    }
  }
};
</script>
<style lang="scss" scoped>
label {
  font-weight: 100;
}
.app-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  .app-container {
    flex: 1;
    height: 100%;
    // background: #f1f3f7;
    // padding: 20px;
    .block {
      width: 100%;
      height: 100%;
      background: #fff;
      .server {
        height: 40px;
        line-height: 40px;
        color: #409eff;
        .title {
          padding-left: 20px;
        }
      }
      .searchList {
        padding: 20px 20px 20px;
        // display: flex;
        // justify-content: space-between;
        // flex-wrap: wrap;
        .search-item {
          font-size: 14px;
          color: #333;
          display: flex;
          flex-wrap: wrap;
          .item-con {
            display: flex;
            span {
              display: inline-block;
              width: 60px;
              text-align: right;
              line-height: 28px;
              margin-right: 10px;
            }
          }
          .item {
            width: 180px;
            margin-right: 10px;
          }
        }
      }
    }
  }
  .infoFormSty {
    display: flex;
    span {
      display: inline-block;
      color: #999;
      font-size: 13px;
      margin-left: 20px;
    }
  }
  .detail-header {
    display: flex;
    justify-content: space-around;
    .detail-title {
      flex: 1;
      text-align: left;
    }
    .detail-btn {
      flex: 1;
      text-align: right;
    }
  }
  .detail-container {
    margin-top: 10px;
    display: flex;
    .detail-tab {
      width: 100%;
      .tab-header {
        color: #666;
      }
      .tab-container {
        width: 100%;
        margin-top: 15px;
      }
    }
  }
}
</style>

